package com.springboot.jktj.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.springboot.common.annotation.Log;
import com.springboot.common.core.controller.BaseController;
import com.springboot.common.core.domain.AjaxResult;
import com.springboot.common.enums.BusinessType;
import com.springboot.jktj.domain.JktjEntering;
import com.springboot.jktj.service.IJktjEnteringService;
import com.springboot.common.utils.poi.ExcelUtil;
import com.springboot.common.core.page.TableDataInfo;

/**
 * 体检结果Controller
 * 
 * @author springboot
 * @date 2023-12-05
 */
@RestController
@RequestMapping("/jktj/entering")
public class JktjEnteringController extends BaseController
{
    @Autowired
    private IJktjEnteringService jktjEnteringService;

    /**
     * 查询体检结果列表
     */
    @PreAuthorize("@ss.hasPermi('jktj:entering:list')")
    @GetMapping("/list")
    public TableDataInfo list(JktjEntering jktjEntering)
    {
        startPage();
        List<JktjEntering> list = jktjEnteringService.selectJktjEnteringList(jktjEntering);
        return getDataTable(list);
    }

    /**
     * 导出体检结果列表
     */
    @PreAuthorize("@ss.hasPermi('jktj:entering:export')")
    @Log(title = "体检结果", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, JktjEntering jktjEntering)
    {
        List<JktjEntering> list = jktjEnteringService.selectJktjEnteringList(jktjEntering);
        ExcelUtil<JktjEntering> util = new ExcelUtil<JktjEntering>(JktjEntering.class);
        util.exportExcel(response, list, "体检结果数据");
    }

    /**
     * 获取体检结果详细信息
     */
    @PreAuthorize("@ss.hasPermi('jktj:entering:query')")
    @GetMapping(value = "/{entId}")
    public AjaxResult getInfo(@PathVariable("entId") Long entId)
    {
        return success(jktjEnteringService.selectJktjEnteringByEntId(entId));
    }

    /**
     * 新增体检结果
     */
    @PreAuthorize("@ss.hasPermi('jktj:entering:add')")
    @Log(title = "体检结果", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody JktjEntering jktjEntering)
    {
        return toAjax(jktjEnteringService.insertJktjEntering(jktjEntering));
    }

    /**
     * 修改体检结果
     */
    @PreAuthorize("@ss.hasPermi('jktj:entering:edit')")
    @Log(title = "体检结果", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody JktjEntering jktjEntering)
    {
        return toAjax(jktjEnteringService.updateJktjEntering(jktjEntering));
    }

    /**
     * 删除体检结果
     */
    @PreAuthorize("@ss.hasPermi('jktj:entering:remove')")
    @Log(title = "体检结果", businessType = BusinessType.DELETE)
	@DeleteMapping("/{entIds}")
    public AjaxResult remove(@PathVariable Long[] entIds)
    {
        return toAjax(jktjEnteringService.deleteJktjEnteringByEntIds(entIds));
    }
}
